package me.jessyan.mvparms.demo.mvp.ui.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jess.arms.base.BaseHolder;
import com.jess.arms.base.DefaultAdapter;
import com.platform.ai.control.R;


import java.util.List;

import butterknife.BindView;

import me.jessyan.mvparms.demo.mvp.model.entity.Discover;

/**
 * Created by 95 on 2017/9/5.
 */
public class DiscoverAdapter extends DefaultAdapter<Discover> {

    public DiscoverAdapter(List<Discover> discovers) {
        super(discovers);
    }

    @Override
    public BaseHolder getHolder(View v, int viewType) {
        return new DiscoverHolder(v);
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_discover;
    }

    public class DiscoverHolder extends BaseHolder<Discover> {
        @BindView(R.id.iv_img)
        ImageView mImg;

        @BindView(R.id.tv_label)
        TextView mLabel;

        @BindView(R.id.tv_content)
        TextView mContent;

        public DiscoverHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void setData(Discover data, int position) {
            mImg.setImageResource(data.getType());
            mLabel.setText(data.getLabel());
            mContent.setText(data.getContent());
        }
    }



}
